import Vue from 'vue'
import VueRouter from 'vue-router'
import index from '../views/movie/index.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:'/movie'
  },
  {
    path: '/movie',
    component: () => import('../views/movie/index.vue'),
	//二级路由，使用children进行配置
	children:[
		{
			path:'City',
			 component: () => import('../components/City.vue'),
		},
		{
			path:'NowPlaying',
			 component: () => import('../components/NowPlaying.vue'),
		},
		{
			path:'ComingSoon',
			 component: () => import('../components/ComingSoon.vue'),
		},
		{
			path:'Search',
			 component: () => import('../components/Search.vue'),
		},
		//重定向，当路径为/movie时，重定向到/movie/NowPlaying路径
		{
			path:'/movie',
			redirect:'/movie/NowPlaying'
		}
	]
	
  },
  {
    path: '/cinema',
    name: 'cinema',
    component: () => import('../views/cinema/index.vue')
  },
  {
    path: '/mine',
    name: 'mine',
     component: () => import('../views/mine/index.vue')
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
